/*工程质量抽查后台*/
'use strict';
const qualityCheckAddAction = require('../actions/qualityCheck/qualityCheckAddAction');
const qualityCheckUpdateAction = require('../actions/qualityCheck/qualityCheckUpdateAction');
const qualityCheckDelAction = require('../actions/qualityCheck/qualityCheckDelAction');
const qualityCheckQueryAction = require('../actions/qualityCheck/qualityCheckQueryAction');

module.exports = async function (ctx) {
    let param = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    let action_type = param.action_type;
    try {
        switch (action_type) {
            case 'qualityCheckAdd': // 工程质量抽查添加
                ctx.body = await qualityCheckAddAction(param);
                break;
            case 'qualityCheckUpdate': // 工程质量抽查修改
                ctx.body = await qualityCheckUpdateAction(param);
                break;
            case 'qualityCheckDel': // 工程质量抽查删除
                ctx.body = await qualityCheckDelAction(param);
                break;
            case 'qualityCheckQuery': // 工程质量抽查查询
                ctx.body = await qualityCheckQueryAction(param);
                break;
        }
    } catch (e) {
        ctx.body = {success: false, message: e.message};
    }

};